package com.作业.Day12;

import lombok.AllArgsConstructor;
import lombok.Data;

import java.util.ArrayList;
import java.util.Collection;

public class Homework2 {
    public static void main(String[] args) {
         Collection c = new ArrayList<>();
          c.add(new Student("张三",100));
          c.add(new Student("李四",20));
          c.add(new Student("王五",20));
        Object[] array = c.toArray();
        for (int i1 = 0; i1 < array.length; i1++) {
               Student student = (Student) array[i1];
               System.out.println(student.getName());
        }
        for (Object o : c) {
            Student student = (Student) o;
        }
    }


}
@AllArgsConstructor
@Data
class Student{
  String name;
  int age;
}
